using ns0;
using ns4;
using System;
using System.Collections.Generic;
namespace ns9
{
	public sealed class EAN8Writer : UPCEANWriter
	{
		private const int int_0 = 67;
		public override ByteMatrix encode(string contents, BarcodeFormat format, int width, int height, Dictionary<object, object> hints)
		{
			if (format != BarcodeFormat.EAN_8)
			{
				throw new ArgumentException("Can only encode EAN_8, but got " + format);
			}
			return base.encode(contents, format, width, height, hints);
		}
		public override sbyte[] encode(string contents)
		{
			if (contents.get_Length() != 8)
			{
				throw new ArgumentException("Requested contents should be 8 digits long, but got " + contents.get_Length());
			}
			sbyte[] array = new sbyte[67];
			int num = 0 + UPCEANWriter.appendPattern(array, 0, UPCEANReader.int_4, 1);
			for (int i = 0; i <= 3; i++)
			{
				int num2 = int.Parse(contents.Substring(i, i + 1 - i));
				num += UPCEANWriter.appendPattern(array, num, UPCEANReader.int_6[num2], 0);
			}
			num += UPCEANWriter.appendPattern(array, num, UPCEANReader.int_5, 0);
			for (int i = 4; i <= 7; i++)
			{
				int num2 = int.Parse(contents.Substring(i, i + 1 - i));
				num += UPCEANWriter.appendPattern(array, num, UPCEANReader.int_6[num2], 1);
			}
			num += UPCEANWriter.appendPattern(array, num, UPCEANReader.int_4, 1);
			return array;
		}
	}
}
